package conf

import (
	"github.com/spf13/viper"
	"go.uber.org/zap"
)

// Neo4jSection map toml [neo4j]
type Neo4jSection struct {
	Uri      string
	User     string
	Password string
	Database string
}

// ReadNeo4j get neo4j section from config
func ReadNeo4j(v *viper.Viper, slog *zap.SugaredLogger) (neo4jConfPtr *Neo4jSection) {
	neo4jConfPtr = &Neo4jSection{}
	err := v.Unmarshal(neo4jConfPtr)
	if err != nil {
		slog.Panicf("unable to decode into neo4j section, %v", err)
	}
	return
}
